﻿<!DOCTYPE html>
<html>
<head>
    <title>CGI</title>
</head>
<body>
    <h1>Our Page</h1>
    <script>
        //01
        //hasOwnProperty function exist in Object.prototype and
        //here directly exist in project object itself
        
        var hireEmployee = function (name) {
        };
        //sanity check wheather this is a function or not
        console.log(typeof hireEmployee);
        

        //02
        /*
        var hireEmployee = function (name) {
            throw ('Error');
        };

        //hireEmployee('JJ');
        //we call action, but error caught information is different
        var action = hireEmployee;
        action('JJ');
        */

        //03
        //solution
        //just give the name for anonymous function
        /*
        var hireEmployee = function myHireEmployeeFn(name) {
            throw ('Error');
        };
        var action = hireEmployee
        action('JJ');
        */
    </script>
</body>
</html>